package com.yfp.operation.controller;

import com.yfp.common.core.domain.R;
import com.yfp.operation.domain.dto.OrderComboGroupDTO;
import com.yfp.operation.domain.dto.OrderDTO;
import com.yfp.operation.service.OrderComboService;
import com.yfp.operation.service.OrderListService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *
 * @version 1.0
 * @date 2024-05-21 9:40
 */
@RestController
@RequestMapping("/order")
@Tag(name = "保存取餐码-客服端")
public class OrderController {

    @Resource
    private OrderListService orderListService;
    @Resource
    private OrderComboService orderComboService;

    /**
     * 保存取餐码
     *
     * @param orderDTO
     * @return
     */
    @PutMapping("/checkcode")
    @Operation(summary = "保存取餐码")
    public R saveCheckCode(@RequestBody OrderDTO orderDTO) {
        orderListService.saveCheckCode(orderDTO);
        return R.ok();
    }

    @PostMapping("group/status")
    @Operation(summary = "获取订单状态", description = "H5-团餐页面使用")
    public R<List<OrderComboGroupDTO>> listGroupOrderInfo(@RequestBody List<String> orderSn) {
        List<OrderComboGroupDTO> orderComboList = orderComboService.listGroupOrderInfo(orderSn);
        return R.ok(orderComboList);
    }
}
